package cn.factorybox.item.config;

import cn.factorybox.item.mapper.FactoryJudgeValueMapper;
import cn.factorybox.model.entity.FactoryJudgeValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @author flypig
 * @version 1.0
 * @date 2020-11-30 2:07
 */

/**
 *  项目启动时，将环境数据阈值缓存到全局变量，减少对阈值的查找
 */
@Component
public class CodeCache {

    /**环境阈值全局变量**/
    public static List<FactoryJudgeValue> thresholdList;

    @Autowired
    private FactoryJudgeValueMapper factoryJudgeValueMapper;

    @PostConstruct
    public void init() {
        // 项目启动时，就加载thresholdList
        thresholdList = factoryJudgeValueMapper.selectThreshold();
    }

}
